/**
* This is an abstract Fruit class that is a super class of Orange and Apple classes.
* Very short class with only two attributes and one constructor, abstract toString
* method and a compareTo method. 
*
* @author Veniamin Kozubenko
*
* @see "No Borrowed Code" 
*/
public abstract class Fruit implements Comparable 
{
	public String fruitName;
	public int price;
	
	public Fruit(String fruitName, int price)
	{
		this.fruitName = fruitName;
		this.price = price;
	} // End explicit value constructor
	
	public abstract String toString();

	public int compareTo(Object o)
	{
		/*ans bl*/
        Fruit fruit;
		if (!(o instanceof Fruit))
			{
			System.out.println("Not a Fruit object! Exiting program...");
			System.exit(-1);
			}
		fruit = (Fruit) o;
	   if (fruitName.compareToIgnoreCase(fruit.fruitName) != 0)
			return fruitName.compareTo(fruit.fruitName);
		else if  (price != fruit.price)
			return price - fruit.price;
		else
			return 0;
      /*ans ab*/
	} // End compareTo method 
} // End class Fruit